﻿"use strict"

exports.index = function(){
    let branch = this.branch;
    let data = {"branch":branch,"server":{},"opensdk":{}};
    data['sid'] = this.get("sid",'int')||1;
    data['format'] = this.config("orderOne");
    this.view = "branch/orderOne"; 
    let server = this.model.branch("server",branch);
    return server.mget(["name"]).then(ret=>{
        for(let k in ret){
            let v = ret[k];
            let sid = v._id;
            data["server"][sid] = v.name;
        }
    }).then(()=>{
        return data;
    })
}

exports.page = function(){
    this.output = 'json';
    let sid = this.get('sid','int');
    if(!sid){
        return this.error('args empty')
    }
    let branch = this.branch;
    return this.library("game/request",branch,sid,'/orderOne/page',this.req.body);
}
